package cn.com.bluemoon.daps.system.controller;

import cn.com.bluemoon.daps.common.datascope.BmPermission;
import cn.com.bluemoon.daps.common.datascope.IgnorePermission;
import cn.com.bluemoon.daps.common.domain.FeignApiRespBean;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.domp.api.LocalDompService;
import cn.com.bluemoon.daps.domp.api.param.UserDto;
import cn.com.bluemoon.daps.system.service.impl.LocalDompServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author Lilike on 2023/1/2
 */
@RestController
public class LocalDompController {

    @Autowired
    private LocalDompServiceImpl localDompService;

    @IgnorePermission(name = "暂时忽略")
    @PostMapping("/user/dompLogin")
    public FeignApiRespBean<String> dompLogin(
            @RequestParam(name = "userId") String userId,
            @RequestParam(name = "password") String password,
            @RequestParam(name = "validationCode",required = false) String validationCode) {
        return localDompService.dompLogin(userId,password,validationCode);
    }

    @IgnorePermission(name = "暂时忽略")
    @PostMapping("/getMenuPathByTokenAndUserId")
    public Map<String, List<LocalDompService.MenuDto>> getMenuPathByTokenAndUserId(
            @RequestParam(name = "token") String token,
            @RequestParam(name = "userId") String userId) {
        return localDompService.getMenuPathByTokenAndUserId(token,userId);
    }
}
